package com.ziyueyuwen.xiniao.bean.product;

import com.ziyueyuwen.xiniao.enums.ProductClassRuleEnum;
import com.ziyueyuwen.xiniao.enums.CourseQuarterEnum;
import com.ziyueyuwen.xiniao.valid.group.interfaces.product.ProductSave;
import com.ziyueyuwen.xiniao.valid.group.interfaces.product.ProductUpdate;
import org.hibernate.validator.constraints.Range;
import org.springframework.format.annotation.DateTimeFormat;

import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
import java.util.Date;

/**
 * @author wancheng  on 2018/12/18.
 */
public class ProductSaveAO {

    @NotNull(message = "商品id不能为空",groups = {ProductUpdate.class})
    private Integer id;

    @NotNull(message = "商品名称不能为空",groups = {ProductUpdate.class, ProductSave.class})
    private String productName;

    @NotNull(message = "课程不能为空",groups = {ProductUpdate.class, ProductSave.class})
    @Min(value = 1,message = "课程id最小值为1",groups = {ProductUpdate.class, ProductSave.class})
    private Integer courseId;

    @NotNull(message = "班级不能为空",groups = {ProductUpdate.class, ProductSave.class})
    @Min(value = 1,message = "课程id最小值为1",groups = {ProductUpdate.class, ProductSave.class})
    private Integer classId;

    @NotNull(message = "价格不能为空",groups = {ProductUpdate.class, ProductSave.class})
    @Range(min=0,max=10000000,message="价格{min}到{max}范围之内",groups = {ProductUpdate.class, ProductSave.class})
    private Integer price;


    @DateTimeFormat(pattern="yyyy-MM-dd")
    private Date beginDay;


    @DateTimeFormat(pattern="yyyy-MM-dd")
    private Date endDay;

    @NotNull(message = "开始日期不能为空",groups = {ProductUpdate.class, ProductSave.class})
    @DateTimeFormat(pattern="HH:mm")
    private Date beginTime;


    @NotNull(message = "结束时间不能为空",groups = {ProductUpdate.class, ProductSave.class})
    @DateTimeFormat(pattern="HH:mm")
    private Date endTime;

    @Min(value = 1,message = "最小值为{value}")
    private Integer stageId;

    private @NotNull(message = "上课规则不能为空",groups = {ProductUpdate.class, ProductSave.class}) ProductClassRuleEnum classRule;

    @NotNull(message = "课程类型不能为空")
    private CourseQuarterEnum type;

    private String productImgUrl;

    private String descriptionImgUrl;


    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getProductName() {
        return productName;
    }

    public void setProductName(String productName) {
        this.productName = productName;
    }

    public Integer getClassId() {
        return classId;
    }

    public void setClassId(Integer classId) {
        this.classId = classId;
    }

    public Integer getPrice() {
        return price;
    }

    public void setPrice(Integer price) {
        this.price = price;
    }

    public Date getBeginDay() {
        return beginDay;
    }

    public void setBeginDay(Date beginDay) {
        this.beginDay = beginDay;
    }

    public Date getEndDay() {
        return endDay;
    }

    public void setEndDay(Date endDay) {
        this.endDay = endDay;
    }

    public Date getBeginTime() {
        return beginTime;
    }

    public void setBeginTime(Date beginTime) {
        this.beginTime = beginTime;
    }

    public Date getEndTime() {
        return endTime;
    }

    public void setEndTime(Date endTime) {
        this.endTime = endTime;
    }

    public ProductClassRuleEnum getClassRule() {
        return classRule;
    }

    public void setClassRule(ProductClassRuleEnum classRule) {
        this.classRule = classRule;
    }

    public String getProductImgUrl() {
        return productImgUrl;
    }

    public void setProductImgUrl(String productImgUrl) {
        this.productImgUrl = productImgUrl;
    }

    public String getDescriptionImgUrl() {
        return descriptionImgUrl;
    }

    public void setDescriptionImgUrl(String descriptionImgUrl) {
        this.descriptionImgUrl = descriptionImgUrl;
    }

    public Integer getStageId() {
        return stageId;
    }

    public void setStageId(Integer stageId) {
        this.stageId = stageId;
    }

    public CourseQuarterEnum getType() {
        return type;
    }

    public void setType(CourseQuarterEnum type) {
        this.type = type;
    }

    public Integer getCourseId() {
        return courseId;
    }

    public void setCourseId(Integer courseId) {
        this.courseId = courseId;
    }
}
